package cn.common;

import java.io.IOException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.LinkedList;
import java.util.List;

import cn.bean.Image;
import cn.log.Log;
import cn.util.HttpUtil;

public class MainTest {

	public static void main(String[] args) throws IOException {
		//ResourceBundle bundle = ResourceBundle.getBundle("config/config.properties");
		//String url = bundle.getString("host")+18323;
		go();
//		String content = HttpUtil.getHtmlContent(url);
//		FileUtil.putStr2File("F:/test1.html", content);
//		Log.info(FileUtil.deleteFile("E:/Pictures/htmlsave/11t30.jpg"));
//		test();

	}
	public static void go(){
		String url = "http://www.mzitu.com/26575/18";
		//Log.info(HttpUtil.getHtmlContent(url));
		while(url!=null){
			String nextUrl = MainTest.process(url);
			url = nextUrl;
		};
	}

	public static String process(String url){

		Image img = HttpUtil.getImageInfoByUrl(url);
		String imgSrc = img.getSrc();
		String nextUrl = img.getNextUrl();
		String filePath = "E:/Pictures/htmlsave/";
		HttpUtil.saveHtmlImage2DB(img, filePath);
		Log.info("nextURL-->"+nextUrl);
		return nextUrl;
	}
	
	public static void test(){
		LinkedList quen = new LinkedList();
		quen.add("1");
		quen.add("2");
		quen.add("3");
		Log.info(quen.get(1));
	}
}
